from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from db.init import init_data, init_db
from api.main import api_router


app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # 允许所有源
    allow_credentials=True,
    allow_methods=["*"],  # 允许所有方法
    allow_headers=["*"],  # 允许所有头
)

app.include_router(api_router, prefix="/api/v1", tags=["api"])


init_db()
# init_data()
